package com.zxx.pattern.statePattern.state2;

/**
 * 入住可以退房
 * @author zxx on 2021/1/18
 */
public class CheckInState implements State2 {

    Room2 hotelManagement;

    public CheckInState(Room2 hotelManagement) {
        this.hotelManagement = hotelManagement;
    }

    @Override
    public void bookRoom() {
        System.out.println("该房间已经入住了...");
    }

    @Override
    public void unsubscribeRoom() {
        //不需要做操作
    }

    @Override
    public void checkInRoom() {
        System.out.println("该房间已经入住了...");
    }

    @Override
    public void checkOutRoom() {
        System.out.println("退房成功....");

        //状态变成空闲
        hotelManagement.setState2(hotelManagement.getFreeTimeState());
    }
}
